home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_03 / saks / decouple.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-04  |  380 b   |  31 lines

  1. Listing 5 - Decoupling the class hierarchy structure from 
  2. application code using a member typedef.
  3.  
  4. //
  5. // class library code
  6. //
  7.  
  8. class B
  9.     {
  10. public:
  11.     void f();
  12.     ...
  13.     };
  14.  
  15. class D : public B
  16.     {
  17. public:
  18.     typedef B inherited;
  19.     void f();
  20.     };
  21.  
  22. //
  23. // library user's code
  24. //
  25.  
  26. void g(D *pd)
  27.     {
  28.     pd->inherited::f();
  29.     ...
  30.     }
  31.